{% extends 'sys_templates/public/base.html' %}
{% block content %}
    <blockquote class="layui-elem-quote">
        欢迎您使用TL_CMS 标准后台管理系统!<span class="f-14"> v1.0</span> &nbsp;&nbsp;开发者QQ：1368419640
        <a href="javascript:;"
           onclick="level_add('{{ current_user.username }}信息','{{ url_for('cms_bp.admin_edit',id=current_user.id) }}','','600','400')"><span
                class="user_edit">修改信息</span></a>
    </blockquote>
    <fieldset class="layui-elem-field layui-field-title site-title">
        <legend><a name="default">信息统计</a></legend>
    </fieldset>
    <table class="layui-table">
        <thead>
        <tr>
            <th>统计</th>
            <th>栏目数</th>
            <th>档案库</th>
            <th>采集规则</th>
            <th>用户</th>
            <th>管理员</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>总数</td>
            <td>{{ data_s.col_num }}</td>
            <td>{{ data_s.doc_num }}</td>
            <td>{{ data_s.coll_num }}</td>
            <td>{{ data_s.member_num }}</td>
            <td>{{ data_s.admin_num }}</td>
        </tr>
        </tbody>
    </table>
    <table class="layui-table">
        <thead>
        <tr>
            <th colspan="2" scope="col">服务器信息</th>
        </tr>
        </thead>
        <tbody>
        <tr>
            <td>服务器域名</td>
            <td>{{ data_s.host }}</td>
        </tr>
        <tr>
            <td>服务器端口</td>
            <td>{{ data_s.port or '80' }}</td>
        </tr>
        <tr>
            <td>服务器IP地址</td>
            <td id="id_address">未联网</td>
        </tr>

        <tr>
            <td>系统所在目录</td>
            <td>{{ data_s.sys_path }}</td>
        </tr>
        <tr>
            <td>服务器当前日期</td>
            <td id="sys_time"></td>
        </tr>
        <tr>
            <td>当前系统用户名</td>
            <td>{{ current_user.username }}-{{ current_user.remark }}</td>
        </tr>
        </tbody>
    </table>
{% endblock %}
{% block footer_js %}
    <script>
        function NowTime() {
            var time = new Date();
            var year = time.getFullYear();
            var month = time.getMonth();
            var day = time.getDate();
            var h = time.getHours();
            var m = time.getMinutes();
            var s = time.getSeconds();

            h = check(h);
            m = check(m);
            s = check(s);
            document.getElementById("sys_time").innerHTML = year + "年" + month + "月" + day + "日  " + h + ":" + m + ":" + s;
        }

        function check(i) {
            var num;
            i < 10 ? num = "0" + i : num = i;
            return num;
        }
        $(function () {
            setInterval("NowTime()", 1000);
            IP = $.ajax({url: "http://www.httpbin.org/ip", async: false});
            response = eval('(' + IP.responseText + ')').origin.split(',')[0];
            $('#id_address').text(response);
        });
    </script>
{% endblock %}